#define _CRT_SECURE_NO_WARNINGS 1

void reorderList(struct ListNode* head) {
    struct ListNode* pcur = head;
    int count = 0;

    struct ListNode* pcarr[50001];
    while (pcur)
    {
        pcarr[count] = pcur;
        count++;
        pcur = pcur->next;
    }

    pcur = head;
    int left = 0;
    int right = count - 1;
    while (left <= right)
    {
        pcur->next = pcarr[left];
        pcur = pcarr[left];
        pcur->next = pcarr[right];
        pcur = pcarr[right];
        left++;
        right--;
    }
    pcur->next = NULL;
}